package com.listener;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.yinhai.util.NotificationController;
import com.yinhai.util.Util;

/**
 * 监听Home键
 * 
 * 
 */
public class HomeReceiver extends BroadcastReceiver {
    
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) {
            String reason = intent.getStringExtra("reason");
            if (reason != null) {
                if (reason.equals("homekey")) {
                    // 在会议界面
                    if (Util.isConferenceTop(context)) {
                        // 当拨打或接听时
                    } else
                        NotificationController.getInstance().showPhoneNotification(1);
                }
                // else if(reason.equals("recentapps")){
                //
                // }
            }
        } else if (intent.getAction().equals(NotificationController.PHONE_NOTIFICATION_ACTION)) {
            // PhoneUtils.moveTask();
            
        }
    }
}
